package main

import (
	"context"
	"git.900sui.cn/kc/base/utils"
	"git.900sui.cn/kc/kcgin"
	"git.900sui.cn/kc/kcgin/logs"
	"git.900sui.cn/kc/rpcinterface/client/order"
	"github.com/robfig/cron"
)

//解冻存管资金任务
func thawDeposAmount()  {
	new(utils.KcLog).GetInstance( kcgin.AppConfig.String("crontab.log.pinganThaw"))
	rpcPingan := new(order.PingAn).Init()
	args := 1
	reply := false
	err := rpcPingan.ThawDeposAmount(context.Background(), &args, &reply )
	if err != nil{
		utils.Logerr.Printf("解冻存管资金任务失败, 错误信息:%v.", err.Error())
		return
	}
	utils.Logerr.Printf("解冻存管资金任务执行完成")
}

func main() {
	logs.Info("Environment Variable:MSF_ENV:", kcgin.KcConfig.RunMode)
	c := cron.New()
	//每30秒执行一次
	spec := "*/30 * * * * ?" //秒-分-时-日-月-周【忽略】
	_ = c.AddFunc(spec,thawDeposAmount)
	c.Start()
	select {}
}
